#ifndef PORT_TYPES_H_
#define PORT_TYPES_H_
/******************************************************************
| includes
| 1) system and project includes
| 2) needed interfaces from external units
| 3) internal and external interfaces from this unit
|-----------------------------------------------------------------*/
#include "Std_Types.h"

/*******************************************************************
| defines and macros (scope: module-local)
|------------------------------------------------------------------*/
/**  brief PORT_PIN_MAX_NUM macro: the number of Pins in the TC1782
 **/
#define PORT_PIN_MAX_NUM				((PortPinIdType)240)

/**  brief PORT_PIN_INVALID_VALUE macro: the invalid hardware pin value
 **/
#define PORT_PIN_INVALID_VALUE				((PortPinIdType)0xFF)

/**  brief PORT_MAX_NUM macro: the number of ports in the TC1782
 **/
#define PORT_MAX_NUM				((uint8)11)


/*******************************************************************
| typedefs and structures (scope: module-local)
|------------------------------------------------------------------*/

typedef struct
{
	uint8 PortNumberOfPortPins;
}PortContainerType, * PortContainerTypeRef;

typedef enum
{
	PORT_PIN_IN = 0,
	PORT_PIN_OUT,
}Port_PinDirectionType;

typedef uint8 PortPinIdType, Port_PinType;

typedef uint8 PortIdType;

typedef enum
{
	PORT_PIN_MODE_ADC,
	PORT_PIN_MODE_CAN,
	PORT_PIN_MODE_DIO,
	PORT_PIN_MODE_DIO_GPT,
	PORT_PIN_MODE_DIO_WDG,
	PORT_PIN_MODE_FLEXRAY,
	PORT_PIN_MODE_ICU,
	PORT_PIN_MODE_LIN,
	PORT_PIN_MODE_MEM,
	PORT_PIN_MODE_PWM,
	PORT_PIN_MODE_SPI,
}Autosar_Port_PinModeType;
typedef enum
{
	PORT_PIN_LEVEL_LOW = 0,
	PORT_PIN_LEVEL_HIGH = 1,
}PortPinLevelValueType;
typedef enum
{
	PORT_PIN_FUNC_GPIO = 0x00,
	PORT_PIN_FUNC_ALT1 = 0x01,
	PORT_PIN_FUNC_ALT2 = 0x02,
	PORT_PIN_FUNC_ALT3 = 0x03,
	PORT_PIN_FUNC_ALT4 = 0x04,
}Port_PinOutFuncModeType, Port_PinInFuncModeType, Port_PinFuncModeType, Port_PinModeType;

typedef enum
{
	PORT_PIN_A1_MEDIUM = 0x0,
	PORT_PIN_A1_WEAK = 0x1,

	PORT_PIN_A1P_STRONG_SOFT = 0x0,
	PORT_PIN_A1P_STRONG_SLOW = 0x1,
	PORT_PIN_A1P_MEDIUM = 0x4,
	PORT_PIN_A1P_WEAK = 0x5,


	PORT_PIN_A2_STRONG_SHARP = 0x0,
	PORT_PIN_A2_STRONG_MEDIUM = 0x1,
	PORT_PIN_A2_STRONG_SOFT = 0x2,
	PORT_PIN_A2_STRONG_SHARP_MINUS = 0x3,
	PORT_PIN_A2_MEDIUM = 0x4,
	PORT_PIN_A2_STRONG_MEDIUM_MINUS = 0x6,
	PORT_PIN_A2_WEAK = 0x7,
}Port_PinDriverModeType;

typedef enum
{
	PORT_PIN_NO_PULL 	= 0,
	PORT_PIN_PULL_DOWN	= 1,
	PORT_PIN_PULL_UP 	= 2,
}Port_PinInCharType;

typedef enum
{
	PORT_PIN_PUSH_PULL = 0,
	PORT_PIN_OPEN_DRAIN = 4,
}Port_PinOutCharType;

typedef uint8 Port_PinInPcCodeType, Port_PinOutPcCodeType;

typedef boolean Port_PinEmStopFlagType;

typedef PortPinLevelValueType Port_PinEmStopLevelType;

typedef enum
{
	PORT_INIT_LOCK = 1,
	PORT_INIT_UNLOCK = 0,
}Port_InitLockType;

typedef struct
{
	Port_PinDirectionType	PortPinDirection;
	boolean					PortPinDirectionChangeable;
	boolean					PortPinModeChangeable;
	PortPinIdType			PortPinId;
	PortPinLevelValueType	PortPinLevelValue;
	Port_PinInFuncModeType	Port_PinInFuncMode;
	Port_PinDriverModeType 	PortPinDriverMode;
	Port_PinOutFuncModeType Port_PinOutFuncMode;
	Port_PinInPcCodeType	Port_PinInPcCode;
	Port_PinOutPcCodeType	Port_PinOutPcCode;
	Port_PinEmStopFlagType	Port_PinEmStop;
	Port_PinEmStopLevelType	Port_PinEmStopLevel;
}PortPinType, *PortPinTypeRef, Port_ConfigType, *Port_ConfigTypeRef;
typedef struct
{
	PortContainerTypeRef 		PortContainers;
}PortConfigSetType, *PortConfigSetTypeRef;

#endif /* PORT_TYPES_H_ */
